import request from 'utils/request';

export function getchannels() {
  return request({
    url: '/channels',
  });
}

export function getarticles(params) {
  return request({
    url: '/mp/articles',
    params,
  });
}

export function delarticles(id) {
  return request({
    url: `/mp/articles/${id}`,
    method: 'delete',
  });
}

export function addarticles(draft, data) {
  return request({
    url: `/mp/articles?draft=${draft}`,
    method: 'post',
    data,
  });
}

export function getarticlesDetail(id) {
  return request({
    url: `mp/articles/${id}`,
    method: 'get',
  });
}

export function editarticles(id, draft, data) {
  return request({
    url: `mp/articles/${id}?draft=${draft}`,
    method: 'put',
    data,
  });
}
